﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Huirui.Cavan.Domain.MainBoundedContext.StockModule;
using Huirui.Cavan.Domain.MainBoundedContext.SystemModule;

namespace Huirui.Cavan.Domain.MainBoundedContext.SalesModule
{
    public class SalesModuleFactory
    {
        public static SalesOrder CreateSalesOrder(string id, DateTime saleDate, DateTime deliveryDate, string currency, decimal currencyRate, string customerOrderNumber, string deliveryAddress,
            SalesIdentifier.CheckType checkType, string remark, decimal discountRate, decimal discountAmount, int receiptType, int receiptCondition, int payDay, DateTime deadDay,
           SalesIdentifier.StockOutStatus stockOutStatus, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation, Customer customer, Employee saleEmployee, WareHouse wareHouse, Project project, SystemIdentifier.CheckedStatus checkedStatus)
        {
            SalesOrder salesOrder = new SalesOrder(id, saleDate, deliveryDate, currency, currencyRate, customerOrderNumber, deliveryAddress, checkType, remark,
                discountRate, discountAmount, receiptType, receiptCondition, payDay, deadDay, stockOutStatus, createDate, modifyDate, editUser, corporation, customer, saleEmployee, wareHouse, project, checkedStatus);

            return salesOrder;
        }

        public static SalesOrderDetail CreateSalesOrderDetail(decimal number, decimal unitCost, decimal discountRate, decimal discountAmount, decimal salesAmount,
            decimal wholeAmount, decimal taxRate, decimal taxAmount, string description, DateTime createDate, DateTime modifyDate, int editUser, SalesOrder salesOrder,
            Stock stock, WareHouse wareHouse)
        {
            SalesOrderDetail salesOrderDetail = new SalesOrderDetail(number, unitCost, discountRate, discountAmount, salesAmount, wholeAmount, taxRate, taxAmount, description,
                createDate, modifyDate, editUser, salesOrder, stock, wareHouse);

            return salesOrderDetail;
        }

        public static Sale CreateSale(string id, DateTime salesDate, string deliveryCode, string deliveryAddress, string customerOrderCode, string checkCode, int checkType,
            string remark, decimal discountRate, int receiptType, int receiptCondition,
            int payDay, DateTime deadDate, string currency, decimal currencyRate, decimal taxRate, DateTime createDate, DateTime modifyDate, int editUser,
            Corporation corporation, Customer customer, Employee salesEmployee, Project project, WareHouse wareHouse, Receipt receipt,
            SalesOrder salesOrder, Account receiptAccount, Employee receiptEmployee)
        {
            Sale sale = new Sale(id, salesDate, deliveryCode, deliveryAddress, customerOrderCode, checkCode, checkType, remark, discountRate, receiptType,
                receiptCondition, payDay, deadDate, currency, currencyRate, taxRate, createDate, modifyDate, editUser,
                corporation, customer, salesEmployee, project, wareHouse, receipt, salesOrder, receiptAccount, receiptEmployee);

            return sale;
        }

        public static Receipt CreateReceipt(string id, DateTime receiptDate, Account toAccount, string accountNumber, decimal amount, decimal discount, string currency, decimal currencyRate, Employee receiptEmployee, string remark, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation, Customer customer)
        {
            Receipt receipt = new Receipt(id, receiptDate, toAccount, accountNumber, amount, discount, currency, currencyRate, receiptEmployee, remark, createDate, modifyDate, editUser, corporation, customer);

            return receipt;
        }

        public static ReceiptDetail CreateReceiptDetail(decimal amount, DateTime certificateDate, DateTime createDate, DateTime modifyDate, int editUser, Receipt receipt, Receivables receivables)
        {
            ReceiptDetail receiptDetail = new ReceiptDetail(amount, certificateDate, createDate, modifyDate, editUser, receipt, receivables);

            return receiptDetail;
        }

        public static Receivables CreateReceivables(DateTime receiveDate, string currency, decimal currencyRate, string remark,
            decimal discount, Account receiptAccount, int payDay, DateTime deadDate, decimal amount, SalesIdentifier.ReceivablesType receivablesType, string receivablesCode,
            DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation, Customer customer, Employee receiveEmployee, Project project)
        {
            Receivables otherReceivables = new Receivables(receiveDate, currency, currencyRate, remark, discount,
                receiptAccount, payDay, deadDate, amount, receivablesType, receivablesCode, createDate, modifyDate, editUser, corporation, customer, receiveEmployee, project);

            return otherReceivables;
        }

        public static SalesReturn CreateSalesReturn(string id, DateTime returnDate, string deliveryCode, string currency, decimal currencyRate, decimal taxRate, string salesCode, string deliveryAddress, string checkCode, string remark, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation, Customer customer, Employee saleEmployee, Project project, WareHouse wareHouse, string contact, string contactTelephone)
        {
            SalesReturn salesReturn = new SalesReturn(id, returnDate, deliveryCode, currency, currencyRate, taxRate, salesCode, deliveryAddress, checkCode, remark, createDate, modifyDate,
                editUser, corporation, customer, saleEmployee, project, wareHouse, contact, contactTelephone);

            return salesReturn;
        }

        public static SalesReturnDetail CreateSalesReturnDetail(decimal number, decimal unitCost, decimal discountRate, decimal discountAmount, decimal salesAmount, decimal wholeAmount, decimal taxRate, decimal taxAmount, string description, DateTime createDate, DateTime modifyDate, int editUser, SalesReturn salesReturn, Stock stock, WareHouse wareHouse)
        {
            SalesReturnDetail salesReturnDetail = new SalesReturnDetail(number, unitCost, discountRate, discountAmount, salesAmount, wholeAmount, taxRate, taxAmount, description,
                createDate, modifyDate, editUser, salesReturn, stock, wareHouse);

            return salesReturnDetail;
        }

        public static SalesPrice CreateSalesPrice(string id, string corporationCode, SalesIdentifier.PriceType type, int customerType, DateTime startDate, DateTime? endDate, string remark, DateTime createDate, DateTime modifyDate, int editUser)
        {
            SalesPrice salesPrice = new SalesPrice(id, corporationCode, type, customerType, startDate, endDate, remark, createDate, modifyDate, editUser);

            return salesPrice;
        }

        public static SalesPriceDetail CreateSalesPriceDetail(SalesPrice salesPrice, Stock stock, decimal unitCost, decimal discountRate, DateTime createDate, DateTime modifyDate, int editUser)
        {
            SalesPriceDetail salesPriceDetail = new SalesPriceDetail(salesPrice, stock, unitCost, discountRate, createDate, modifyDate, editUser);

            return salesPriceDetail;
        }
    }
}
